Function: prepend(domElementOrMarkupStringOrCSSSelector, domInsertionElement, functionCallback(domElement)) Description: Inserts a DOM element, markup string, or CSS selector referenced element at the top of a target element in the DOM. Returns: domElement, or $A object if chained. Example: // Insert a DOM element at the top of another element targetted with a CSS selector var myElement = $A.prepend(domElement, "#myTargetNodeId"); // Insert a markup string element at the top of another DOM element var myElement = $A.prepend('
Here we are now, entertain us.
', domElement); // Insert one element referenced by a CSS selector at the top of another DOM element var myElement = $A.prepend("#myTargetNodeToMove", domElement); // Insert a DOM element at the top of another DOM element and exicute a callback when done var myElement = $A.prepend(domElementToMove, domElementToTarget, function(domElementToMove) { // Do something with domElementToMove after the insertion is complete. }); // Or the same using chaining // Insert a DOM element at the top of another element targetted with a CSS selector var myChain = $A("#myTargetNodeId").prepend(domElement); // Insert a markup string element at the top of another DOM element var myChain = $A(domElement).prepend('
Here we are now, entertain us.
'); // Insert one element referenced by a CSS selector at the top of another DOM element var myChain = $A(domElement).prepend("#myTargetNodeToMove"); // Insert a DOM element at the top of another DOM element and exicute a callback when done var myChain = $A(domElementToTarget).prepend(domElementToMove, function(domElementToMove) { // Do something with domElementToMove after the insertion is complete. }); // To return the modified element within a chain, use the "return()" method. var myElement = myChain.return();